/*
 * Copyright (c) 2012 Universidad Antonio de Nebrija.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Apache License v2.0
 * which accompanies this distribution, and is available at
 * http://www.apache.org/licenses/LICENSE-2.0.html
 * 
 * Contributors:
 *    Universidad Antonio de Nebrija - initial API, implementation and documentation
 */
package com.nebrija.riif.model.saver.bufferedwriter;

import java.io.BufferedWriter;

import com.nebrija.riif.model.saver.AssertValidationSaver;
import com.nebrija.riif.model.saver.ChildComponentListSaver;
import com.nebrija.riif.model.saver.ChildComponentUnitSaver;
import com.nebrija.riif.model.saver.ComponentSaver;
import com.nebrija.riif.model.saver.RIIFPropertiesSaver;
import com.nebrija.riif.model.saver.RIIFSaverFactory;

/**
 * Implementation of RIIFSaverFactory for a family of objects that save the information
 * in a bufferedwriter
 * @author asanchep
 *
 */
public class RIIFWriterFormatSaverFactory implements RIIFSaverFactory{

	private BufferedWriter out;
	
	public RIIFWriterFormatSaverFactory(BufferedWriter writer){
		setOut(writer);
	}

	public BufferedWriter getOut() {
		return out;
	}

	public void setOut(BufferedWriter out) {
		this.out = out;
	}

	@Override
	public ComponentSaver getComponentSaver() {
		return new ComponentWriterFormatSaver(getOut(), this);
	}

	@Override
	public RIIFPropertiesSaver getRIIFPropertiesSaver() {
		return new RIIFPropertiesWriterFormatSaver(getOut(), this);
	}

	@Override
	public AssertValidationSaver getAssertValidationSaver() {
		return new AssertValidationWriterFormatSaver(getOut(), this);
	}

	@Override
	public ChildComponentUnitSaver getChildComponentUnitSaver() {
		return new ChildComponentUnitWriterFormatSaver(getOut(), this);
	}

	@Override
	public ChildComponentListSaver getChildComponentListSaver() {
		return new ChildComponentListWriterFormatSaver(getOut(), this);
	}	

}
